package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.SealJurXmlfile;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISealJurXmlfileService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 印章授权xml文件Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/sealJurXmlFile")
public class SealJurXmlfileController extends BaseController
{
    @Autowired
    private ISealJurXmlfileService sealJurXmlfileService;

    /**
     * 查询印章授权xml文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:xmlfile:list')")
    @GetMapping("/list")
    public TableDataInfo list(SealJurXmlfile sealJurXmlfile)
    {
        startPage();
        List<SealJurXmlfile> list = sealJurXmlfileService.selectSealJurXmlfileList(sealJurXmlfile);
        return getDataTable(list);
    }

    /**
     * 导出印章授权xml文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:xmlfile:export')")
    @Log(title = "印章授权xml文件", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SealJurXmlfile sealJurXmlfile)
    {
        List<SealJurXmlfile> list = sealJurXmlfileService.selectSealJurXmlfileList(sealJurXmlfile);
        ExcelUtil<SealJurXmlfile> util = new ExcelUtil<SealJurXmlfile>(SealJurXmlfile.class);
        return util.exportExcel(list, "印章授权xml文件数据");
    }

    /**
     * 获取印章授权xml文件详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:xmlfile:query')")
    @GetMapping(value = "/{sjXmlFileId}")
    public AjaxResult getInfo(@PathVariable("sjXmlFileId") Long sjXmlFileId)
    {
        return AjaxResult.success(sealJurXmlfileService.selectSealJurXmlfileBySjXmlFileId(sjXmlFileId));
    }

    /**
     * 新增印章授权xml文件
     */
    @PreAuthorize("@ss.hasPermi('system:xmlfile:add')")
    @Log(title = "印章授权xml文件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SealJurXmlfile sealJurXmlfile)
    {
        return toAjax(sealJurXmlfileService.insertSealJurXmlfile(sealJurXmlfile));
    }

    /**
     * 修改印章授权xml文件
     */
    @PreAuthorize("@ss.hasPermi('system:xmlfile:edit')")
    @Log(title = "印章授权xml文件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SealJurXmlfile sealJurXmlfile)
    {
        return toAjax(sealJurXmlfileService.updateSealJurXmlfile(sealJurXmlfile));
    }

    /**
     * 删除印章授权xml文件
     */
    @PreAuthorize("@ss.hasPermi('system:xmlfile:remove')")
    @Log(title = "印章授权xml文件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sjXmlFileIds}")
    public AjaxResult remove(@PathVariable Long[] sjXmlFileIds)
    {
        return toAjax(sealJurXmlfileService.deleteSealJurXmlfileBySjXmlFileIds(sjXmlFileIds));
    }
}
